package com.qckj.amz.domain.spapi.feeds.home.PricingFeedXml;

import com.qckj.amz.utils.constants.AmzConstants;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlValue;

/**
 * @author luchuan
 * @version v1.0
 * @date 2022/11/19 0019
 **/

@XmlAccessorType(XmlAccessType.FIELD)//用于指定由java对象生成xml文件时对java对象属性的访问方式,FIELD作用是指java对象中的所有成员变量
@Data
public class StandardPrice {

    @XmlValue//每个类只允许有一个 @XmlValue
    private String StandardPrice;

    @XmlAttribute(name = "currency")
    private String currency;


    /**
     * 赋值对应币种的售价
     * 当前采用构造函数赋值，在new StandardPrice(currencyCode, standardPrice_currency)时，自动调用赋值
     * @param currencyCode              币种代码
     * @param standardPrice_currency    售价
     */
    public StandardPrice(String currencyCode, String standardPrice_currency) {
             if (currencyCode.equals(AmzConstants.CURRENCY_AUD)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_CAD)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_EUR)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_GBP)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_INR)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_JPY)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_MXN)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_PLN)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_SEK)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_SGD)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
        else if (currencyCode.equals(AmzConstants.CURRENCY_USD)){this.StandardPrice = standardPrice_currency;this.currency = currencyCode;}
    }
}
